/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "clearing_fundstate")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FundState.findAll", query = "SELECT f FROM FundState f"),
    @NamedQuery(name = "FundState.findById", query = "SELECT f FROM FundState f WHERE f.id = :id"),
    @NamedQuery(name = "FundState.findByClearingDate", query = "SELECT f FROM FundState f WHERE f.clearingDate = :clearingDate"),
    @NamedQuery(name = "FundState.findByAccountCode", query = "SELECT f FROM FundState f WHERE f.accountCode = :accountCode"),
    @NamedQuery(name = "FundState.findByFundTotal", query = "SELECT f FROM FundState f WHERE f.fundTotal = :fundTotal"),
    @NamedQuery(name = "FundState.findByFundAvl", query = "SELECT f FROM FundState f WHERE f.fundAvl = :fundAvl"),
    @NamedQuery(name = "FundState.findByFundFroze", query = "SELECT f FROM FundState f WHERE f.fundFroze = :fundFroze"),
    @NamedQuery(name = "FundState.findByAssetTotal", query = "SELECT f FROM FundState f WHERE f.assetTotal = :assetTotal"),
    @NamedQuery(name = "FundState.findByAssetNet", query = "SELECT f FROM FundState f WHERE f.assetNet = :assetNet"),
    @NamedQuery(name = "FundState.findByAssetCredit", query = "SELECT f FROM FundState f WHERE f.assetCredit = :assetCredit"),
    @NamedQuery(name = "FundState.findByPosTotalValue", query = "SELECT f FROM FundState f WHERE f.posTotalValue = :posTotalValue"),
    @NamedQuery(name = "FundState.findByPosNetValue", query = "SELECT f FROM FundState f WHERE f.posNetValue = :posNetValue"),
    @NamedQuery(name = "FundState.findByPosCreditValue", query = "SELECT f FROM FundState f WHERE f.posCreditValue = :posCreditValue"),
    @NamedQuery(name = "FundState.findByCurrency", query = "SELECT f FROM FundState f WHERE f.currency = :currency"),
    @NamedQuery(name = "FundState.findByRate", query = "SELECT f FROM FundState f WHERE f.rate = :rate"),
    @NamedQuery(name = "FundState.findByEqualFundAvl", query = "SELECT f FROM FundState f WHERE f.equalFundAvl = :equalFundAvl"),
    @NamedQuery(name = "FundState.findByBefAssetTotal", query = "SELECT f FROM FundState f WHERE f.befAssetTotal = :befAssetTotal"),
    @NamedQuery(name = "FundState.findByBefFundAvl", query = "SELECT f FROM FundState f WHERE f.befFundAvl = :befFundAvl"),
    @NamedQuery(name = "FundState.findByOwnUserID", query = "SELECT f FROM FundState f WHERE f.ownUserID = :ownUserID"),
    @NamedQuery(name = "FundState.findByAlterUserID", query = "SELECT f FROM FundState f WHERE f.alterUserID = :alterUserID"),
    @NamedQuery(name = "FundState.findByCreateTime", query = "SELECT f FROM FundState f WHERE f.createTime = :createTime"),
    @NamedQuery(name = "FundState.findByTimeStamp", query = "SELECT f FROM FundState f WHERE f.timeStamp = :timeStamp")})
public class FundState implements Serializable {
	public static byte[] EnCode(FundState msg) throws IOException {
		Codec<FundState> Lcode = ProtobufProxy.create(FundState.class);
		return Lcode.encode(msg);
	}
	public static FundState DeCode(byte[] data) throws IOException {
	Codec<FundState> Lcode = ProtobufProxy.create(FundState.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Column(name = "ClearingDate")
    @Temporal(TemporalType.DATE)
    private Date clearingDate;
	@Protobuf
	private long clearingDateL;
    @Basic(optional = false)
    @Column(name = "AccountCode")
    @Protobuf
	private String accountCode;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "FundTotal")
    @Protobuf
	private Float fundTotal;
    @Column(name = "FundAvl")
    @Protobuf
	private Float fundAvl;
    @Column(name = "FundFroze")
    @Protobuf
	private Float fundFroze;
    @Column(name = "AssetTotal")
    @Protobuf
	private Float assetTotal;
    @Column(name = "AssetNet")
    @Protobuf
	private Float assetNet;
    @Column(name = "AssetCredit")
    @Protobuf
	private Float assetCredit;
    @Column(name = "PosTotalValue")
    @Protobuf
	private Float posTotalValue;
    @Column(name = "PosNetValue")
    @Protobuf
	private Float posNetValue;
    @Column(name = "PosCreditValue")
    @Protobuf
	private Float posCreditValue;
    @Column(name = "Currency")
    @Protobuf
	private String currency;
    @Column(name = "Rate")
    @Protobuf
	private Float rate;
    @Column(name = "EqualFundAvl")
    @Protobuf
	private Float equalFundAvl;
    @Column(name = "BefAssetTotal")
    @Protobuf
	private Float befAssetTotal;
    @Column(name = "BefFundAvl")
    @Protobuf
	private Float befFundAvl;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public FundState() {
    }

    public FundState(Integer id) {
        this.id = id;
    }

    public FundState(Integer id, String accountCode) {
        this.id = id;
        this.accountCode = accountCode;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getClearingDate() {
        return clearingDate;
    }

    public void setClearingDate(Date clearingDate) {
        this.clearingDate = clearingDate;
        this.setClearingDateL(CodeTool.DateToLong(clearingDate));
    }

    public String getAccountCode() {
        return accountCode;
    }

    public void setAccountCode(String accountCode) {
        this.accountCode = accountCode;
    }

    public Float getFundTotal() {
        return fundTotal;
    }

    public void setFundTotal(Float fundTotal) {
        this.fundTotal = fundTotal;
    }

    public Float getFundAvl() {
        return fundAvl;
    }

    public void setFundAvl(Float fundAvl) {
        this.fundAvl = fundAvl;
    }

    public Float getFundFroze() {
        return fundFroze;
    }

    public void setFundFroze(Float fundFroze) {
        this.fundFroze = fundFroze;
    }

    public Float getAssetTotal() {
        return assetTotal;
    }

    public void setAssetTotal(Float assetTotal) {
        this.assetTotal = assetTotal;
    }

    public Float getAssetNet() {
        return assetNet;
    }

    public void setAssetNet(Float assetNet) {
        this.assetNet = assetNet;
    }

    public Float getAssetCredit() {
        return assetCredit;
    }

    public void setAssetCredit(Float assetCredit) {
        this.assetCredit = assetCredit;
    }

    public Float getPosTotalValue() {
        return posTotalValue;
    }

    public void setPosTotalValue(Float posTotalValue) {
        this.posTotalValue = posTotalValue;
    }

    public Float getPosNetValue() {
        return posNetValue;
    }

    public void setPosNetValue(Float posNetValue) {
        this.posNetValue = posNetValue;
    }

    public Float getPosCreditValue() {
        return posCreditValue;
    }

    public void setPosCreditValue(Float posCreditValue) {
        this.posCreditValue = posCreditValue;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public Float getRate() {
        return rate;
    }

    public void setRate(Float rate) {
        this.rate = rate;
    }

    public Float getEqualFundAvl() {
        return equalFundAvl;
    }

    public void setEqualFundAvl(Float equalFundAvl) {
        this.equalFundAvl = equalFundAvl;
    }

    public Float getBefAssetTotal() {
        return befAssetTotal;
    }

    public void setBefAssetTotal(Float befAssetTotal) {
        this.befAssetTotal = befAssetTotal;
    }

    public Float getBefFundAvl() {
        return befFundAvl;
    }

    public void setBefFundAvl(Float befFundAvl) {
        this.befFundAvl = befFundAvl;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FundState)) {
            return false;
        }
        FundState other = (FundState) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.FundState[ id=" + id + " ]";
    }

    public long getClearingDateL() {
        return clearingDateL;
    }

    public void setClearingDateL(long clearingDateL) {
        this.clearingDateL = clearingDateL;
		this.clearingDate = CodeTool.LongToDate(clearingDateL);
    }
    
}
